<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "tb_user".
 *
 * @property integer $user_id
 * @property string $name
 * @property string $pwd
 * @property integer $mobile
 * @property string $email
 * @property integer $totalPoints
 * @property integer $currentPoints
 * @property string $photo
 * @property string $sex
 * @property string $realName
 * @property integer $qqNum
 * @property string $address
 * @property integer $registered
 * @property integer $collected
 * @property string $signTime
 * @property integer $perfectdata
 * @property integer $regdate
 * @property integer $lastdate
 * @property integer $loginnum
 * @property string $regip
 * @property string $lastip
 * @property string $source
 * @property string $openid
 * @property string $unionid
 * @property string $web_from
 * @property string $email_code
 */
class TbUser extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tb_user';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('passportdb');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'pwd', 'email', 'totalPoints', 'currentPoints', 'photo', 'sex', 'realName', 'qqNum', 'address', 'registered', 'collected', 'signTime', 'perfectdata', 'regdate', 'lastdate', 'loginnum', 'regip', 'lastip', 'source', 'openid', 'unionid', 'web_from', 'email_code'], 'required'],
            [['mobile', 'totalPoints', 'currentPoints', 'qqNum', 'registered', 'collected', 'perfectdata', 'regdate', 'lastdate', 'loginnum'], 'integer'],
            [['sex', 'source'], 'string'],
            [['signTime'], 'safe'],
            [['name', 'email', 'web_from'], 'string', 'max' => 50],
            [['pwd'], 'string', 'max' => 32],
            [['photo'], 'string', 'max' => 200],
            [['realName'], 'string', 'max' => 30],
            [['address', 'openid', 'unionid'], 'string', 'max' => 100],
            [['regip', 'lastip'], 'string', 'max' => 15],
            [['email_code'], 'string', 'max' => 20],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'user_id' => 'User ID',
            'name' => 'Name',
            'pwd' => 'Pwd',
            'mobile' => 'Mobile',
            'email' => 'Email',
            'totalPoints' => 'Total Points',
            'currentPoints' => 'Current Points',
            'photo' => 'Photo',
            'sex' => 'Sex',
            'realName' => 'Real Name',
            'qqNum' => 'Qq Num',
            'address' => 'Address',
            'registered' => 'Registered',
            'collected' => 'Collected',
            'signTime' => 'Sign Time',
            'perfectdata' => 'Perfectdata',
            'regdate' => 'Regdate',
            'lastdate' => 'Lastdate',
            'loginnum' => 'Loginnum',
            'regip' => 'Regip',
            'lastip' => 'Lastip',
            'source' => 'Source',
            'openid' => 'Openid',
            'unionid' => 'Unionid',
            'web_from' => 'Web From',
            'email_code' => 'Email Code',
        ];
    }
}
